export function setStorage(key, val, type = 'session') {
  if (type === 'session') {
    sessionStorage.setItem(key, JSON.stringify(val))
  } else {
    localStorage.setItem(key, JSON.stringify(val))
  }
}

export function getStorage(key, type = 'session') {
  if (type === 'session') {
    return JSON.parse(sessionStorage.getItem(key))
  } else {
    return JSON.parse(localStorage.getItem(key))
  }
}

export function removeStorage(key, type = 'session') {
  if (type === 'session') {
    sessionStorage.removeItem(key)
  } else {
    localStorage.removeItem(key)
  }
}
